fix(tests): use UTC methods for timezone-independent schedule assertions#3052
fix(tests): use UTC methods for timezone-independent schedule assertions#3052waleedlatif1 merged 1 commit intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile OverviewGreptile SummaryThis PR fixes timezone-dependent test failures by replacing local date methods with UTC equivalents in schedule test assertions. Changes Made:
Why This Matters: By using UTC methods, the tests now correctly validate the actual UTC time values that Croner calculates, making the tests timezone-independent. Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Test as Test Suite
participant API as Schedule API/Utils
participant Croner as Croner Library
participant Date as Date Object
Test->>API: Calculate next run time with cron
API->>Croner: Generate next occurrence
Croner->>Croner: Calculate in specified timezone
Croner-->>API: Return Date object (UTC timestamp)
API-->>Test: Return Date object
Note over Test,Date: OLD: Test used local methods
Test->>Date: getMinutes() / getDate() / etc.
Date-->>Test: Returns LOCAL timezone value ❌
Note over Test: Fails in timezones like UTC+05:30
Note over Test,Date: NEW: Test uses UTC methods
Test->>Date: getUTCMinutes() / getUTCDate() / etc.
Date-->>Test: Returns UTC value ✅
Note over Test: Works in all timezones
|
Summary
getMinutes(),getSeconds(),getDate(), etc. with UTC equivalents in schedule testsFixes #3045
Type of Change
Testing
Tested with multiple timezones: UTC, Asia/Kolkata (UTC+05:30), Australia/Adelaide (UTC+09:30), Asia/Kathmandu (UTC+05:45)
Checklist